﻿using Fee.Sync;
using JwtWebApi.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;

namespace JwtWebApi.Controllers
{
    [Authorize]
    [Route("[controller]")]
    [ApiController]
    [EnableCors]
    public class SyncController : Controller
    {
        private readonly StationSyncer<ApplicationDbContext> _stationSyncer;

        public SyncController(StationSyncer<ApplicationDbContext> stationSyncer)
        {
            _stationSyncer = stationSyncer;
        }
        [HttpGet("Station")]
        public IActionResult StationSync()
        {
            _stationSyncer.Sync();
            return Json(new
            {
                successed = true,
            });
        }
    }
}